package micro86.operation;

import micro86.engine.Memory;
import micro86.engine.State;
import micro86.engine.parametres.IntParameter;

/**
 * Created with IntelliJ IDEA.
 * User: alar
 * Date: 26.02.13
 * Time: 15:08
 * To change this template use File | Settings | File Templates.
 */
public class Cmr implements IOperation{
    IntParameter source;
    IntParameter destination;

    public Cmr(IntParameter source, IntParameter destination){
        this.source = source;
        this.destination = destination;
    }

    @Override
    public void execute(State state, Memory memory) {
        int targetValue = source.get(state) - destination.get(state);
        state.setSFbyResult(targetValue);
        state.setZFByResult(targetValue);
        state.incIP();
    }


}
